package com.platform.core.entity;

import com.platform.comm.enums.YnEnum;
import com.platform.enums.CommFlagType;
import com.platform.enums.converters.CommFlagTypeConverter;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * Description: 部门信息实体类
 *
 * @author libin Created on 2019/7/18
 **/
@EqualsAndHashCode()
@Data
@Entity
@Table(name = "ncloud_sys_depart")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SysDepart implements Serializable {

    private static final long serialVersionUID = 1019983100905062922L;
    @Id
    @Column(name = "id", length = 36)
    @Getter
    @Setter
    private String id;
    /**
     * 部门名称
     */
    @Column(name = "depart_name", length = 300, nullable = false)
    private String departName;

    /**
     * 父部门ID
     */
    @Column(name = "depart_parent", length = 36)
    private String parentId;

    /**
     * 部门类型
     */
    @Column(name = "depart_kind", length = 10)
    private String departKind;

    /**
     * 统一社会信用代码
     */
    @Column(name = "dept_unified_code", length = 18)
    private String unifiedCode;

    /**
     * 部门编码
     */
    @Column(name = "depart_code", length = 128)
    private String departCode;

    /**
     * 部门全称
     */
    @Column(name = "full_name", length = 360)
    private String fullName;

    /**
     * 名称路由
     */
    @Column(name = "route_name", length = 1024)
    private String routeName;

    /**
     * 编码路由
     */
    @Column(name = "route_code", length = 512)
    private String routeCode;

    /**
     * 部门层级
     */
    @Column(name = "depart_level")
    private Integer level;

    /**
     * 所属管理域
     */
    @Column(name = "manage_domain", length = 36)
    private String domain;

    /**
     * 行政区划代码
     */
    @Column(name = "region_id", length = 128)
    private String regionId;

    /**
     * 状态
     */
    @Column(name = "status", length = 20)
    @Convert(converter = CommFlagTypeConverter.class)
    private CommFlagType status;

    /**
     * 状态标志
     */
    @Column(name = "delflag")
    private YnEnum delFlag;

    /**
     * 排序编号
     */
    @Column(name = "depart_sort")
    private Integer sortNum;

    /**
     * 备注
     */
    @Column(name = "remark", length = 512)
    private String remark;

    /**
     * 创建时间
     */
    @CreatedDate
    @Column(name = "create_date", nullable = false, updatable = false)
    private LocalDateTime createDate;

    /**
     * 修改时间
     */
    @LastModifiedDate
    @Column(name = "update_date")
    private LocalDateTime updateDate;

    /**
     * 机构类型
     */
    @Column(name = "org_type", length = 128)
    private String orgType;

    /**
     * 信息来源
     */
    @Column(name = "info_source", length = 256)
    private String infoSource;

    /**
     * 直接负责人用户ID
     */
    @Column(name = "leader_id", length = 30)
    private String leaderId;
}
